import meunApi from '@/api/declaration/meunApi'
import httpRequest from '@/config/axios/httpRequest'
import {
  CreateMenuReq,
  CreateMenuResp,
  DeleteMenuReq,
  DeleteMenuResp,
  QueryMenuPageReq,
  QueryMenuPageResp,
  QueryMenuReq,
  QueryMenuResp,
  UpdateMenuReq,
  UpdateMenuResp
} from '@/models/system/MenuModel'

// 查询菜单列表
export const getMenuList = async (params: QueryMenuPageReq) => {
  return await httpRequest.get<QueryMenuPageResp>(meunApi.QueryMenuPage, { params })
}

// 获取菜单详情
export const getMenu = async (params: QueryMenuReq) => {
  return await httpRequest.get<QueryMenuResp>(meunApi.QueryMenuDetail, { params })
}

// 新增菜单
export const createMenu = async (data: CreateMenuReq) => {
  return await httpRequest.post<CreateMenuResp>(meunApi.CreateMenu, data)
}

// 修改菜单
export const updateMenu = async (data: UpdateMenuReq) => {
  return await httpRequest.put<UpdateMenuResp>(meunApi.UpdateMenu, data)
}

// 删除菜单
export const deleteMenu = async (params: DeleteMenuReq) => {
  return await httpRequest.delete<DeleteMenuResp>(meunApi.DeleteMenu, { params })
}
